<template>
  <div class="art-bigBox" v-if="showArticleList.length > 0">
    <div v-for="item in showArticleList" :key="item" class="art-box">
      <div class="txtBox">
        <div class="title">{{item.title}}</div>
        <div class="descColor">{{item.synopsis}}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { getArticleList } from "@/api/public";
export default {
  name: "article-list",
  props: {
    config: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      articleList: []
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      getArticleList({ limit: this.config.count }).then(res => {
        if (res.status == 200) {
          this.articleList = res.data;
        }
      });
    }
  },
  computed: {
    showArticleList() {
      return this.articleList.slice(0, this.config.count);
    }
  }
};
</script>

<style scoped>
.art-bigBox {
  background: #f7f7f7;
}
.descColor {
  color: #999999;
  font-size: 20rpx;
  padding: 10rpx 0;
}
.art-box {
  padding: 10rpx 20rpx;
  background: #ffffff;
  /* margin-bottom: 10rpx; */
}
.art-box .txtBox {
  padding-top: 8rpx;
}
.art-box .txtBox .title {
  width: 300rpx;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  word-break: break-all;
}
</style>
